Skip to content

Fix react-19 external anchor replacement in AnchoredOverlay and share Vitest setup#7820

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/remove-act-warnings-in-tests
Draft

Fix react-19 external anchor replacement in AnchoredOverlay and share Vitest setup#7820
Copilot wants to merge 8 commits intomainfrom
copilot/remove-act-warnings-in-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 7, 2026

Changelog

New

  • Added a shared @primer/vitest-config workspace package for the common Vitest console-enforcement setup.
  • Added package-local config/vitest/setup.js entrypoints so each package can consume the shared Vitest setup without relying on a top-level setup script path.

Changed

  • Updated AnchoredOverlay to re-sync CSS anchor-positioning state when an external anchorRef DOM node is replaced while the overlay remains open.
  • Preserved existing internal renderAnchor behavior while fixing the React 19 external-anchor remount case that caused anchor-name and position-anchor to fall out of sync.
  • Added an inline code comment documenting the React 19-specific external anchor replacement behavior.
  • Updated package Vitest configs to use the new shared setup package through package-local setup entrypoints.

Removed

  • Removed the top-level shared Vitest setup script at script/vitest/setup.ts.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  • Analyzed the failing GitHub Actions test (react-19) job logs for run 25577112553, job 75087602292.
  • Reproduced the original failure locally against packages/react/src/ActionMenu/ActionMenu.test.tsx.
  • Verified the AnchoredOverlay fix with:
    • npx vitest --config vitest.config.browser.mts run src/AnchoredOverlay/AnchoredOverlay.test.tsx
    • npx vitest --config vitest.config.browser.mts run src/ActionMenu/ActionMenu.test.tsx
  • Verified the shared Vitest setup refactor with:
    • npm run lint -- --no-cache
    • npm run type-check
    • cd packages/styled-react && npx vitest --run src/__tests__/exports.test.ts
    • cd packages/react && npx vitest --config vitest.config.browser.mts run src/AnchoredOverlay/AnchoredOverlay.test.tsx
  • Ran secret scanning and final automated review / CodeQL validation.

Merge checklist

Copilot AI and others added 4 commits May 7, 2026 19:34
Agent-Logs-Url: https://github.com/primer/react/sessions/6f872a32-6ca6-4638-b31e-81b5134c5538

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/6f872a32-6ca6-4638-b31e-81b5134c5538

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/6f872a32-6ca6-4638-b31e-81b5134c5538

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/6f872a32-6ca6-4638-b31e-81b5134c5538

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: 9ebb459

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@github-actions github-actions Bot temporarily deployed to storybook-preview-7820 May 7, 2026 20:44 Inactive
@joshblack joshblack added the skip changeset This change does not need a changelog label May 8, 2026
@joshblack
Copy link
Copy Markdown
Member

@copilot fix CI, it is currently broken. Don't submit changes for review until CI is green

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 8, 2026

@copilot fix CI, it is currently broken. Don't submit changes for review until CI is green

Fixed in b0e2fcd. Local validation is green (CI=true npm run test, npm run lint -- --no-cache, npm run type-check, npm run build, npm run lint:css, npm run format:diff -- --cache=false). The new GitHub Actions runs are currently action_required with no jobs, so they need approval before CI can turn green; I have not submitted the PR for review.

Copilot AI and others added 2 commits May 8, 2026 20:41
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copilot AI changed the title Remove test console warnings and add CI enforcement Fix react-19 external anchor replacement in AnchoredOverlay May 8, 2026
Copy link
Copy Markdown
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot create a shared vitest config package that can be used instead of a common script at the top-level

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 8, 2026

@copilot create a shared vitest config package that can be used instead of a common script at the top-level

Addressed in 9ebb459. Added a shared @primer/vitest-config workspace package for the common Vitest setup and updated the package-level Vitest configs to use local setup entrypoints that import it.

Copilot AI changed the title Fix react-19 external anchor replacement in AnchoredOverlay Fix react-19 external anchor replacement in AnchoredOverlay and share Vitest setup May 8, 2026
Copilot AI requested a review from joshblack May 8, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants